public class UserThread extends Thread{

    private  NumberResource numberResource;

    public UserThread(NumberResource numberResource){
        this.numberResource=numberResource;
    }

    @Override
    public void run() {
        try {
           while (true){
               numberResource.showNumber();
           }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
